<%@ page import="com.hncg.entity.User" %>
<%@ page import="com.hncg.dao.UserDao" %><%--
  Created by IntelliJ IDEA.
  User: chongge
  Date: 2024/1/10
  Time: 11:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
    <%
        int id = Integer.parseInt(request.getParameter("id"));
        String name = request.getParameter("name");
        String  pwd = request.getParameter("pwd");
        int age = Integer.parseInt(request.getParameter("age"));
        User user = new User(id,name,pwd,age);
        UserDao userDao = new UserDao();
        boolean result = userDao.updateUser(user);
        if(result){
            out.print("<script>alert('恭喜您,修改成功!')</script>");
            response.sendRedirect("userlist.jsp");
        }else{
            out.print("<script>alert('不好意思,修改失败!')</script>");
            response.sendRedirect("userUpdate.jsp");
        }
    %>
</body>
</html>
